package com.thinkingstar.iads.datacenter.entity.dao;

import java.util.List;

import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.QueryResult;
import org.nutz.dao.pager.Pager;
import org.nutz.dao.sql.Criteria;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;

import com.thinkingstar.iads.common.serviceImpl.EntityRepositoryServiceImpl;
import com.thinkingstar.iads.datacenter.entity.DcProjectDesignFormulaData;
import com.thinkingstar.iads.datacenter.entity.DcProjectDesignFormulaVersion;


/**
 * @ClassName: DaoDcProjectDesignConstantVersion 
 * @Description:数据中心_公式_公式集维护
 * @author 1157372219@qq.com 
 * @date 2018年3月19日   
 */
@IocBean(args = {"refer:dao"})
public class DaoDcProjectDesignFormulaData extends EntityRepositoryServiceImpl<DcProjectDesignFormulaData>{

	public DaoDcProjectDesignFormulaData(Dao dao) {
		super(dao);
	}
	
	//查询公式库公式
	public QueryResult findFormulaDataListByVersionId(NutMap nutMap){
		List<DcProjectDesignFormulaData> page_list = null;
		Pager pager = null;
		Criteria criteria =Cnd.NEW();
		criteria.where().and("del_flag", "=", "0");
		if(nutMap.get("formula_version_id") != null){
			criteria.where().and("formula_version_id", "=", nutMap.get("formula_version_id"));
		}
		criteria.getOrderBy().asc("orderBy+0");
		if(nutMap.get("page_num") != null && nutMap.get("page_size") != null){
			pager = new Pager(nutMap.getInt("page_num"), nutMap.getInt("page_size"));
			pager.setRecordCount(this.count(criteria));
			page_list = query(criteria, pager);
		}else{
			page_list = query(criteria);
		}
		return new QueryResult(page_list, pager);
	}
	

}
